package com.huanong.service.impl;
/*
 *@Author:anran
 *@Date:2020/12/9
 *@Version 1.0
 */

import com.huanong.mapper.PersonMapper;
import com.huanong.pojo.Person;
import com.huanong.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class PersonServiceImpl implements PersonService {

    @Autowired
    private PersonMapper personMapper;

    @Override
    public Person login(Person person) {
        person.setPnTime(new Date());
        return personMapper.login(person);
    }

    @Override
    public boolean checkAccount(String userAccount) {
        Person row = personMapper.queryByAccount(userAccount);
        if (row != null) {
            return false;
        }
        return true;
    }

    @Override
    public int register(Person person) {
        person.setPnTime(new Date());
        return personMapper.register(person);
    }
}
